package com.xiaoshuidi.cloud.module.finance.job.bank;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 同步金蝶的银行信息
 */
@Component("syncBankJob")
public class SyncBankJob extends IJobHandler {

    @Resource
    private BankRepository bankRepository;

    @DS("oracle")
    @Async
    @XxlJob("syncBankJob")
    public void execute() throws Exception {
        bankRepository.queryBankStream(list -> bankRepository.insertBank(list));
    }
}
